<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%zancai_post}}".
 *
 * @property string $ip_address
 * @property integer $post_id
 * @property integer $type
 *
 * @property Post $post
 */
class ZancaiPost extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%zancai_post}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['ip_address', 'post_id'], 'required'],
            [['post_id'], 'integer'],
            [['ip_address'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ip_address' => 'Ip Address',
            'post_id' => 'Post ID',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getPost()
    {
        return $this->hasOne(Post::className(), ['id' => 'post_id']);
    }
}
